package com.cdtye.itps.cms.controller.summary;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.cdtye.common.webcore.web.AjaxJson;
import com.cdtye.itps.cms.dao.summary.vo.JcjcEvalauationSummaryVo;
import com.cdtye.itps.cms.service.summary.JcjcEvalauationSummaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.Map;

import static com.cdtye.common.webcore.web.AjaxJson.success;

/**
 * 汇总综合表接口controller
 * @author Jchen
 * @date 2022-03-24
 */

@Api(tags="汇总综合表接口")
@RestController
@RequestMapping("/jcjcEvalauationSummarys")
public class JcjcEvalauationSummaryController {

    @Autowired
    private JcjcEvalauationSummaryService modelService;

    @ApiOperation(value = "分页查询")
    @GetMapping(value = "/listPage")
    public AjaxJson<IPage<Map<String,Object>>> listPage(JcjcEvalauationSummaryVo vo){
        IPage<Map<String,Object>> result = modelService.listPage(vo);
        return success(result);
    }


    @ApiOperation(value = "列表查询")
    @GetMapping(value = "/listAll")
    public AjaxJson<Map<String,Object>> listAll(JcjcEvalauationSummaryVo vo) throws ParseException {
        return success(modelService.listAll(vo));
    }

    @ApiOperation(value = "列表查询导出")
    @GetMapping(value = "/exportList")
    public AjaxJson<Map<String,Object>> exportList(JcjcEvalauationSummaryVo vo, HttpServletResponse response)throws Exception{
        modelService.exportList(vo,response);
        return success();
    }

    @ApiOperation(value = "首页CDI查询")
    @GetMapping(value = "/indexCDIList")
    public AjaxJson<Map<String,Object>> indexCDIList(String yearOrMonth){
        return success(modelService.indexCDIList(yearOrMonth));
    }

    @ApiOperation(value = "首页线路优良率")
    @GetMapping(value = "/indexLineExcellentRate")
    public AjaxJson<Map<String,Object>> indexLineExcellentRate(){
        return success(modelService.indexLineExcellentRate());
    }

    @ApiOperation(value = "首页CDI本月得分")
    @GetMapping(value = "/indexMonthCDI")
    public AjaxJson<Map<String,Object>> indexMonthCDI(){
        return success(modelService.indexMonthCDI());
    }

    @ApiOperation(value = "首页检测监测数据")
    @GetMapping(value = "/indexDetectData")
    public AjaxJson<Map<String,Object>> indexDetectData(){
        return success(modelService.indexDetectData());
    }
}
